home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilwb / wbstars2.lha / WBStars2.0 / source / WBStars_functions.c < prev    next >
C/C++ Source or Header  |  1996-12-18  |  2KB  |  146 lines

  1. /* $VER: WBStars_functions.c 2.0 (18 Dec 1996)
  2. */
  3.  
  4. #include <proto/graphics.h>
  5. #include <proto/layers.h>
  6.  
  7. #include "WBStars_include.h"
  8. #include "WBStars_protos.h"
  9. #include "WBStars_plot.h"
  10.  
  11. void    SetPixel(int x, int y)
  12. {
  13.     ULONG    APen;        /* because this is not "our" RastPort    */
  14.     ULONG    BPen;        /* we have to save the things that we    */
  15.     ULONG    DrMd;        /* will change to write the Pixel        */
  16.  
  17.     if(!locked) LockLayerInfo(LInfo);
  18.  
  19.     APen    = GetAPen(RPort);    /* get the Pens and    */
  20.     BPen    = GetBPen(RPort);    /* the DrawMode        */
  21.     DrMd    = GetDrMd(RPort);
  22.  
  23.     SetABPenDrMd(RPort, fg_color, BPen, JAM1);    /* set our Pens and DrawMode*/
  24.     WritePixel(RPort,x+minx,y+miny);            /* Write our Pixel            */
  25.  
  26.     SetABPenDrMd(RPort, APen, BPen, DrMd);        /* Reset the Rastport        */
  27.  
  28.     if(!locked) UnlockLayerInfo(LInfo);
  29. }
  30.  
  31. void    ClearPixel(int x, int y)
  32. {
  33.     ULONG    APen;
  34.     ULONG    BPen;
  35.     ULONG    DrMd;
  36.  
  37.     if(!locked) LockLayerInfo(LInfo);
  38.  
  39.     APen    = GetAPen(RPort);
  40.     BPen    = GetBPen(RPort);
  41.     DrMd    = GetDrMd(RPort);
  42.  
  43.     SetABPenDrMd(RPort, bg_color, BPen, JAM1);
  44.     WritePixel(RPort,x+minx,y+miny);
  45.  
  46.     SetABPenDrMd(RPort, APen, BPen, DrMd);
  47.  
  48.     if(!locked) UnlockLayerInfo(LInfo);
  49. }
  50.  
  51. char    SetPixelTest(int x, int y)
  52. {
  53.     ULONG    APen;
  54.     ULONG    BPen;
  55.     ULONG    DrMd;
  56.  
  57.     if(!locked) LockLayerInfo(LInfo);
  58.  
  59.     if( ReadPixel(RPort,x+minx,y+miny)==bg_color )
  60.     {
  61.         APen    = GetAPen(RPort);
  62.         BPen    = GetBPen(RPort);
  63.         DrMd    = GetDrMd(RPort);
  64.  
  65.         SetABPenDrMd(RPort, fg_color, BPen, JAM1);
  66.         WritePixel(RPort,x+minx,y+miny);
  67.  
  68.         SetABPenDrMd(RPort, APen, BPen, DrMd);
  69.  
  70.         if(!locked) UnlockLayerInfo(LInfo);
  71.  
  72.         return TRUE;
  73.     }
  74.  
  75.     if(!locked) UnlockLayerInfo(LInfo);
  76.  
  77.     return FALSE;
  78. }
  79.  
  80. char    ClearPixelTest(int x, int y)
  81. {
  82.     ULONG    APen;
  83.     ULONG    BPen;
  84.     ULONG    DrMd;
  85.  
  86.     if(!locked) LockLayerInfo(LInfo);
  87.  
  88.     if( ReadPixel(RPort,x+minx,y+miny)==fg_color )
  89.     {
  90.         APen    = GetAPen(RPort);
  91.         BPen    = GetBPen(RPort);
  92.         DrMd    = GetDrMd(RPort);
  93.  
  94.         SetABPenDrMd(RPort, bg_color, BPen, JAM1);
  95.         WritePixel(RPort,x+minx,y+miny);
  96.  
  97.         SetABPenDrMd(RPort, APen, BPen, DrMd);
  98.  
  99.         if(!locked) UnlockLayerInfo(LInfo);
  100.  
  101.         return TRUE;
  102.     }
  103.  
  104.     if(!locked) UnlockLayerInfo(LInfo);
  105.  
  106.     return FALSE;
  107. }
  108.  
  109. char    Test1Pixel(int x, int y)
  110. {
  111.     if( ReadPixel(RPort,x+minx,y+miny)==fg_color )
  112.     {
  113.         return TRUE;
  114.     }
  115.  
  116.     return FALSE;
  117. }
  118.  
  119. char    Test0Pixel(int x, int y)
  120. {
  121.     if( ReadPixel(RPort,x+minx,y+miny)==bg_color )
  122.     {
  123.         return TRUE;
  124.     }
  125.  
  126.     return FALSE;
  127. }
  128.  
  129. void    LockPlotArea()
  130. {
  131.     if(!locked)
  132.     {
  133.         LockLayerInfo(LInfo);
  134.         locked=TRUE;
  135.     }
  136. }
  137.  
  138. void    UnlockPlotArea()
  139. {
  140.     if(locked)
  141.     {
  142.         UnlockLayerInfo(LInfo);
  143.         locked=FALSE;
  144.     }
  145. }
  146.